<%@page import="models.SolutionAdoption"%>
<%@ page import="com.googlecode.objectify.Objectify, com.googlecode.objectify.ObjectifyService, com.googlecode.objectify.Query" %>
<%@ page import = "controllers.SolutionConnect, controllers.AdoptionConnect" %>
<%@ page import = "models.SolutionSubmission, models.Location" %>
<%@ page import="java.util.*" %>

<%

String strLocation = request.getParameter("location");
%>

<chart palette="1" caption="Solutions Shared/Adopted For <%=strLocation %>" shownames="1" showvalues="0" numberPrefix="" showSum="1" decimals="0" overlapBars="0" baseFontSize ='9'  showShadow="1">

<categories font='Arial' fontSize='11' fontColor='000000'>

<%

Objectify ofy = ObjectifyService.begin();
Query<Location> qLOC = ofy.query(Location.class).filter("LocationRegionName", strLocation); 
for ( Location f : qLOC.fetch() ) {
	out.println("<category name='" + f.getLocationName() + "' link='/modules/reports/location-search-solution.jsp?region=" + strLocation +"' />"); 
}

%>
	
</categories>

<dataset seriesName="Shared" showValues="0">

<%
qLOC = ofy.query(Location.class).filter("LocationRegionName", strLocation);
for ( Location f : qLOC.fetch() ) {
	Query<SolutionSubmission> qSOL = ofy.query(SolutionSubmission.class).filter("Location", f.getLocationName()).filter("Status", "Shared");
	out.println("<set value='"+ qSOL.countAll() + "' link='/modules/reports/location-search-solution.jsp?region=" + f.getLocationName() +"' />"); 
}
%>

</dataset>

<dataset seriesname='Adopted Solutions' color='0DE12E'>
    
<%
qLOC = ofy.query(Location.class).filter("LocationRegionName", strLocation);
for ( Location f : qLOC.fetch() ) {
	Query<SolutionAdoption> qSOL = ofy.query(SolutionAdoption.class).filter("Location", f.getLocationName());
	out.println("<set value='"+ qSOL.countAll() +"' link='/modules/reports/location-search-solution.jsp?region=" + f.getLocationName() +"' />");
}
%>

</dataset>



</chart>


<!-- 


<chart palette="1" caption="Solutions Shared/Adopted For China " shownames="1" showvalues="0" numberPrefix="" showSum="1" decimals="0" overlapBars="0" baseFontSize ='9'  showShadow="1">

<categories>
List:= @Implode(@Unique(@DbLookup( "Notes" : "NoCache"; ""; "LookupAmericas";"China";2));"~");
temp:=@Explode(List;";") ;
@Implode(@Transform(@Explode(List;"~");"sitename";"<category label='"+sitename+ ""+ +"'/>");""+@NewLine)
</categories>
<dataset seriesName="Shared" showValues="0">
List:= @Implode(@Unique(@DbLookup( "Notes" : "NoCache"; ""; "LookupAmericas";"China";2));"~");
temp:=@Explode(List;";") ;
@Implode(@Transform(@Explode(List;"~");"sitename";"<category label='"+sitename+ ""+ +"'/>");""+@NewLine)
<Computed Value>
</dataset>
<dataset seriesName="Adopted" showValues="0">	

<Computed Value>
</dataset>

</chart>



 -->